local RoomBase = require 'packages.chess-games.xiangqi.core.roombase'

---@class Xiangqi.Room : Xiangqi.RoomBase, ServerRoomBase
local Room = RoomBase:subclass("Xiangqi.Room")

Room:include(Fk.Base.ServerRoomBase)

local GameLogic = require "packages.chess-games.xiangqi.server.gamelogic"
local ServerPlayer = require "packages.chess-games.xiangqi.server.serverplayer"

function Room:initialize(_room)
  RoomBase.initialize(self)
  Fk.Base.ServerRoomBase.initialize(self, _room)

  self.serverplayer_klass = ServerPlayer
  self.logic_klass = GameLogic
end

function Room:movePieceTo(pieceId, fromX, fromY, x, y)
  RoomBase.movePieceTo(self, pieceId, fromX, fromY, x, y)
  self:doBroadcastNotify("Xiangqi.MovePieceTo", { pieceId, fromX, fromY, x, y })
end

function Room:syncBoard()
  self:doBroadcastNotify("Xiangqi.SyncBoard", self.board)
end

return Room

